Occurs before a different row becomes the current row; before the Update method (except when data is saved with the UpdateRow method); and before a Delete, Unload, or Close operation.
Syntax
Private Sub object_Validate ([index As Integer,] action As Integer, reserved As Integer)
The Validate event syntax has these parts:
Part | Description |
Object | An object expression that evaluates to an object in the Applies To list. |
Index | Identifies the control if it's in a control array. |
Action | An Integer or constant that indicates the operation causing this event to occur, as described in Settings. |
Reserved | An Integer argument preserved only for compatibility with RDO version 1.0 and ignored by the Remote Data control. |
Settings
The settings for action are:
Constant | Value | Description |
RdActionCancel | 0 | Cancel the operation when the Sub exits. |
RdActionMoveFirst | 1 | MoveFirst method. |
RdActionMovePrevious | 2 | MovePrevious method. |
RdActionMoveNext | 3 | MoveNext method. |
RdActionMoveLast | 4 | MoveLast method. |
RdActionAddNew | 5 | AddNew method. |
RdActionUpdate | 6 | Update operation (not UpdateRow). |
RdActionDelete | 7 | Delete method. |
RdActionFind | 8 | Find method (not implemented). |
RdActionBookmark | 9 | The Bookmark property has been set. |
RdActionClose | 10 | The Close method. |
RdActionUnload | 11 | The form is being unloaded. |
RdActionUpdateAddNew | 12 | A new row was inserted into the result set. |
RdActionUpdateModified | 13 | The current row changed. |
RdActionRefresh | 14 | Refresh method executed. |
RdActionCancelUpdate | 15 | Update canceled. |
RdActionBeginTransact | 16 | BeginTrans method. |
RdActionCommitTransact | 17 | CommitTrans Method. |
RdActionRollbackTransact | 18 | RollbackTrans Method |
RdActionNewParameters | 19 | Change in parameters, or order of columns or rows. |
RdActionNewSQL | 20 | SQL statement changed. |
Remarks
This event can occur regardless of whether data in bound controls changes, or whether bound controls exist. You can use this event to change values and update data. You can also choose to save data or stop whatever action is causing the event to occur and substitute a different action.
If you attempt to change AddNew or one of the Move methods into any of the other actions (any Move into AddNew, any Move into any other Move, or AddNew into any Move), it results in the action being halted, the same as if you set it to rdActionCancel.
In your code for this event, you can check the data in each bound control where DataChanged is True. You can then set DataChanged to False to avoid saving that data in the database.
Note Because a data-aware control can have more than one bound property, the DataChanged property must be examined for each of the bound properties as enumerated in the Bindings collection.
You can't use any methods (such as MoveNext) on the underlying rdoResultset object during this event.